package com.maxie.service;

import com.maxie.factory.StateFactory;
import com.maxie.state.State;
import com.maxie.state.impl.ChangeState;
import com.maxie.state.impl.CommonState;
import com.maxie.vo.BillVO;

/**
 * 真正的业务类
 */
public class BillService {
    private State state;
    public BillService() {
        // 默认值
        this.state = StateFactory.getState(null);
    }
    public void insert(BillVO vo)
    {
        System.out.println("bill插入数据");
        this.state = StateFactory.getState(vo.getState());
        state.insert();
    }

    public void delete(BillVO vo)
    {
        System.out.println("删除数据");
        this.state = StateFactory.getState(vo.getState());
        state.delete();
    }

    public void update(BillVO vo)
    {
        System.out.println("更新数据");
        this.state = StateFactory.getState(vo.getState());
        state.update();
    }
}
